package o2o.dao.PO.shop;

//店铺评论

import com.jinyou.utils.common.ValidateUtil;
import o2o.cache.shop.ShopMemory;
import o2o.dao.VO.shop.ShopCommentInfoVO;
import o2o.dao.VO.shop.ShopInfoVO;
import o2o.company.model.ShopInfo;
import o2o.task.image.ImageService;
import org.springframework.beans.BeanUtils;

public class ShopCommentInfo {

    private Long id;// ID

    private Long shopId;//店铺id
    private String orderNo;//订单编号
    private String comment;//评价信息
    private String image1Url;//评价图片地址
    private String image2Url;//评价图片地址
    private String image3Url;//评价图片地址
    private String image4Url;//评价图片地址
    private int star;//星级 默认4星
    private int serviceStar;
    private int deliveryStar;
    private int isUnknownName;//是否匿名（1是匿名 0是不匿名）
    private String name;//评论者姓名
    private String signPhoto;//评论者头像
    private int verifyState = 2;    // 认证状态 2 已认证 1 认证中  -1 已驳回

    private int delFlag;// 是否已删除(0未删除,1已删除)
    private String createUser;// 创建者
    private long createTime;// 创建日期 141231212423423时间戳毫秒级标识
    private String updateUser;// 最后更新着
//    private long updateTime;// 最后更新时间

    private String extra1;  //
    private String extra2;
    private String extra3;

    public int getServiceStar() {
        return serviceStar;
    }

    public ShopCommentInfo setServiceStar(int serviceStar) {
        this.serviceStar = serviceStar;
        return this;
    }

    public int getDeliveryStar() {
        return deliveryStar;
    }

    public ShopCommentInfo setDeliveryStar(int deliveryStar) {
        this.deliveryStar = deliveryStar;
        return this;
    }

    public int getVerifyState() {
        return verifyState;
    }

    public ShopCommentInfo setVerifyState(int verifyState) {
        this.verifyState = verifyState;
        return this;
    }

    public ShopCommentInfoVO convert2VO(boolean isCloudShop) {
        ShopCommentInfoVO vo = new ShopCommentInfoVO();
        BeanUtils.copyProperties(this, vo);
        if (vo.getIsUnknownName() == 1) {
            vo.setName("");
            vo.setSignPhoto("");
        }
        if (isCloudShop) {
            ShopInfo shopInfo = ShopMemory.getInstance().getShopById(this.shopId);
            if (shopInfo != null) {
                ShopInfoVO shopInfoVO = new ShopInfoVO();
                BeanUtils.copyProperties(shopInfo, shopInfoVO);
                if (ValidateUtil.isNotNull(shopInfoVO.getImageUrl()) && ValidateUtil.isNotNetUrl(shopInfoVO.getImageUrl())) {
                    String thumb = ImageService.getThumbnailImgUrl(shopInfoVO.getImageUrl(), shopInfo.getImgUpVer(), shopInfo.getThumbnailState());
                    shopInfoVO.setImageThumbnailUrl(thumb);
//                    shopInfoVO.setImageUrl(SYS_CONFIG_PATH.IMAGE_BASE_URL + shopInfoVO.getImageUrl());
                    shopInfoVO.setImageUrl(ImageService.getImgUrl(shopInfo.getImgUpVer()) + shopInfoVO.getImageUrl());
                }
                vo.setShopInfo(shopInfoVO);
            }
        }
        return vo;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getShopId() {
        return shopId;
    }

    public void setShopId(Long shopId) {
        this.shopId = shopId;
    }

    public String getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    public String getImage1Url() {
        return image1Url;
    }

    public void setImage1Url(String image1Url) {
        this.image1Url = image1Url;
    }

    public String getImage2Url() {
        return image2Url;
    }

    public void setImage2Url(String image2Url) {
        this.image2Url = image2Url;
    }

    public String getImage3Url() {
        return image3Url;
    }

    public void setImage3Url(String image3Url) {
        this.image3Url = image3Url;
    }

    public String getImage4Url() {
        return image4Url;
    }

    public void setImage4Url(String image4Url) {
        this.image4Url = image4Url;
    }

    public int getStar() {
        return star;
    }

    public void setStar(int star) {
        this.star = star;
    }

    public int getIsUnknownName() {
        return isUnknownName;
    }

    public void setIsUnknownName(int isUnknownName) {
        this.isUnknownName = isUnknownName;
    }

    public int getDelFlag() {
        return delFlag;
    }

    public void setDelFlag(int delFlag) {
        this.delFlag = delFlag;
    }

    public String getCreateUser() {
        return createUser;
    }

    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }

    public long getCreateTime() {
        return createTime;
    }

    public void setCreateTime(long createTime) {
        this.createTime = createTime;
    }

    public String getUpdateUser() {
        return updateUser;
    }

    public void setUpdateUser(String updateUser) {
        this.updateUser = updateUser;
    }

//    public long getUpdateTime() {
//        return updateTime;
//    }
//
//    public void setUpdateTime(long updateTime) {
//        this.updateTime = updateTime;
//    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSignPhoto() {
        return signPhoto;
    }

    public void setSignPhoto(String signPhoto) {
        this.signPhoto = signPhoto;
    }

    public String getExtra1() {
        return extra1;
    }

    public void setExtra1(String extra1) {
        this.extra1 = extra1;
    }

    public String getExtra2() {
        return extra2;
    }

    public void setExtra2(String extra2) {
        this.extra2 = extra2;
    }

    public String getExtra3() {
        return extra3;
    }

    public void setExtra3(String extra3) {
        this.extra3 = extra3;
    }
}
